package org.meetunexpectedly.config;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Description: 本地缓存
 * @Author: pupil
 * @Date: 2024/08/18 下午 7:57
 */
public class LocalCache {
    private static Map<String,Object> cache = new ConcurrentHashMap();

    /**
     * 添加缓存
     * @param key 键
     * @param val 值
     */
    public static void put(String key,Object val){
        cache.put(key,val);
    }

    /**
     * 判断键是否存在
     * @param key 键
     * @return
     */
    public static Boolean containsKey(String key){
        if (key == null) return false;
        return cache.containsKey(key);
    }

    /**
     * 删除缓存
     * @param key
     */
     public static void remove(String key){
         cache.remove(key);
     }
}
